{
 "metadata": {
  "name": "",
  "signature": "sha256:4eebb6072b0b61472123a6e06bced7315392d2cbef47aff72ec788197fda88c7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "Problems with the current design:\n",
      "\n",
      "* if, when training disag algos, we iterate through appliances then we'll end up training on the same meters labelled as different appliances\n",
      "* when we ask for a power series for an appliance, I think it's not sufficient to give a warning that that meter measures multiple appliances; instead we should return something like a PowerStrip object."
     ]
    },
    {
     "cell_type": "raw",
     "metadata": {},
     "source": [
      ">>> electric['toaster']\n",
      "PowerStrip(dominant=Appliance(type='toaster', instance=1), \n",
      "           others=[Appliance(type='sandwich maker', instance=1)])\n",
      "\n",
      ">>> electric['fridge']\n",
      "Appliance(type='fridge', instance=1)\n",
      "or\n",
      "PowerStrip(dominant=Appliance(type='fridge', instance=1))\n",
      "the latter feels better because then we can simplify life by iterating through all powerstrips and, on each iteration, only getting powerstrip.dominant.\n",
      "\n",
      "The PowerStrip class would contain Appliances.\n",
      "\n",
      "But what if there is no dominant appliance (UK-DALE will be the only dataset with this information).\n",
      ">>> electric['fridge']\n",
      "PowerStrip(dominant=None, others=[Appliance('fridge')])\n",
      "\n",
      "How do we handle functions like on_duration?  Different appliances on the powerstrip could have different on_power_thresholds, and so could be distinguishable, but this will rarely be the case.  So maybe functions like on_duration should just take the minimum on_power_threshold from all appliances and return a single on_duration for the entire powerstrip?\n",
      "\n",
      "How do give a PowerStrip an ID?  I suppose each appliance no longer needs a dataset and a building?  e.g.:\n",
      "\n",
      "PowerStrip(dataset=REDD, building=1, appliances=[(fridge,1), (kettle,1)], dominant=(fridge,1))\n",
      "\n",
      "OR... get rid of PowerStrip idea.  Instead have get_leaf_meters.  And we handle dual-supply at the meter level (i.e. a single meter object with two dataframes, one for each physical meter... which slightly breaks things).\n",
      "\n",
      "Meter(dataset=REDD, building=1, appliances=[(fridge,1), (kettle,1)], dominant=(fridge,1))\n",
      "\n",
      "That is more simple but perhaps feels a little conceptually \"dirty\".  Or maybe not.\n",
      "\n",
      "then, do we ask the meter for its on_duration, activity_distribution, proportion_of_energy etc?  I guess that's OK.  It means the Appliance class becomes quite simple (it's basically just a wrapper around a dict of metadata).\n",
      "\n",
      "What about when we select based on metadata?  I guess we change AppliancGroup to MeterGroup?  (and hence select meters; based I guess on either the dominant appliance (if there is one) or on the \"average\".  What if there isn't an \"average\"? (i.e. all appliances are in a different group)?  Then don't add that meter?  Warn?\n",
      "\n",
      "OK, so here's the new design:\n",
      "\n",
      "* Appliance gets a lot of responsibility taken away and put into EMeter\n",
      "* EMeter will have a subclass for EMeterDualSupply\n",
      "* EMeter will own a list of appliances"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "old notes:\n",
      "\n",
      "ApplianceGroup.disaggregated_leaves() need to think of a better name. distinct leaves? Leaf meters? Separable appliances? Separate appliances? Submetered appliances? Returns list of ApplianceGroups, one per meter or dual supply appliance. Or maybe that's over complex. Basically just need downstream meters except dual supply appliances where we need the two meters together. Maybe I need a PowerStrip class to aggregate multiple appliances under one meter?  No, don't think I need a new class...  All the information we need is encoded in the structures we have, we just need to make sure we process and package it up appropriately. Specifically, we must not try to train a disaggregation algo to learn appliances which we say are separate but are actually the same meter. And ApplianceGroup needs to only count each meter in the group once. "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}